package com.hc.transaction.config;

import com.hc.transaction.aspect.SecureInvokeAspect;
import com.hc.transaction.dao.SecureInvokeRecordDao;
import com.hc.transaction.mapper.SecureInvokeRecordMapper;
import com.hc.transaction.service.MQProducer;
import com.hc.transaction.service.SecureInvokeService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.lang.Nullable;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.concurrent.Executor;

/**
 * Created by wdj on 2024/10/19
 */

@Configuration
@EnableScheduling
@MapperScan(basePackageClasses = SecureInvokeRecordMapper.class)
@Import({SecureInvokeAspect.class, SecureInvokeRecordDao.class})
public class TransactionAutoConfiguration {

    @Nullable
    protected Executor executor;


    @Bean
    public SecureInvokeService getSecureInvokeService(SecureInvokeRecordDao dao) {
        return new SecureInvokeService(dao, executor);
    }

    @Bean
    public MQProducer getMQProducer(){
        return new MQProducer();
    }
}
